package com.tsd.jxc.stock.dao;

import com.tsd.core.vo.PageBean;
import com.tsd.jxc.sale.entity.JxcSaleOrderExt;
import com.tsd.jxc.stock.entity.JxcStockGoods;
import com.tsd.jxc.stock.entity.JxcStockGoodsExt;
import com.tsd.jxc.stock.entity.JxcStockInbillExt;
import com.tsd.jxc.stock.vo.JxcStockGoodsVo;
import com.tsd.system.entity.SysUserExt;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 描述：JxcStockGoodsMapper
 *
 * @author Hillpool
 * @date 2022/07/29 15:06:41
 */
public interface JxcStockGoodsMapper {

    JxcStockGoods selectByPrimaryKey(Long id);

    JxcStockGoodsExt selectBySid(String sid);

    int deleteByPrimaryKey(Long id);

    int insert(JxcStockGoods record);

    int insertSelective(JxcStockGoods record);

    int insertList(@Param("list") List<JxcStockGoodsExt> list);

    int updateByPrimaryKey(JxcStockGoods record);

    int updateByPrimaryKeySelective(JxcStockGoods record);

    int updateList(@Param("list") List<JxcStockGoodsExt> list);

    List<JxcStockGoodsExt> selectByEntity(JxcStockGoodsExt record);

    List<JxcStockGoodsExt> selectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcStockGoodsExt> selectCount1Page(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcStockGoodsExt> selectByParams(@Param("params") Map<String, Object> params);

    List<JxcStockGoodsExt> getAllGoods(@Param("params") Map<String, Object> params);

    List<JxcStockGoodsExt> selectByGoodsSid(String goods_sid);

    int updateStockQtyByInventory(@Param("inventory_sid") String inventory_sid);

    List<JxcStockGoodsExt> selectValidWithAvgInPriceByProductList(@Param("product_list") List<String> product_list);

    Double sumAmount();

    List<JxcStockGoodsVo> select4ClothingByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    int updateStockSumQtyByProductList(@Param("product_list") List<String> product_list);

    void updateBySaleOrder(@Param("params") Map<String, Object> params);

    void updateBySaleReturnBill(@Param("params") Map<String, Object> params);

    void updateByBuyOrder(@Param("params") Map<String, Object> params);

    void updateByBuyReturnBill(@Param("params") Map<String, Object> params);

    /**
     * 根据入库单更新库存，参数是：inbill_sid（入库单sid）,op-操作（1-增加，-1减少）
     * @param params
     */
    void updateQtyFromInBill(@Param("params") Map<String, Object> params);

    void initData(JxcStockGoodsExt t);

    int updateStockSumQty4Init(@Param("goods_list") List<String> goods_list);
}
